package com.sh.admin.controller;

import org.springframework.stereotype.Controller;
import sh.dto.ResultDto;
import sh.entity.Clazz;
import sh.entity.Grade;
import com.sh.admin.service.GradeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 年级表(Grade)表控制层
 *
 * @author makejava
 * @since 2021-05-10 09:49:32
 */
@Controller
@RequestMapping("grade")
public class GradeController {
    /**
     * 服务对象
     */
    @Resource
    private GradeService gradeService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Grade selectOne(Integer id) {
        return this.gradeService.queryById(id);
    }


    /**
     * 查找所有年级
     * @return
     */
    @ResponseBody
    @PostMapping("all")
    public ResultDto findAll(@RequestBody Clazz clazz){
        return gradeService.findAll(clazz);
    }

}
